package com.lqzs.businessmanager.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.lqzs.businessmanager.bean.AccessInfo

@Dao
interface AccessDao {
    @Query("SELECT * FROM meituan_table")
    suspend fun getAll(): MutableList<AccessInfo>

    @Query("SELECT * FROM meituan_table WHERE content = :mContent")
    suspend fun query(mContent:String): AccessInfo?

    @Query("SELECT * FROM meituan_table WHERE reviewId = :reviewId")
    suspend fun queryForId(reviewId:String): AccessInfo?

    @Query("SELECT * FROM meituan_table WHERE upload = 0 OR upload=3")
    suspend fun queryNoUpload(): MutableList<AccessInfo>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertOrUpdate(accessInfo: AccessInfo)

    @Insert
    suspend fun insertAll(accessInfo: AccessInfo)

    @Delete
    suspend fun delete(accessInfo: AccessInfo)

    @Update
    suspend fun update(accessInfo: AccessInfo)
}